#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
const int N = 1e3 + 10;
int p[N];
struct Edge
{
	int a, b, w;
}edge[N];
int n, m;
typedef pair<int, int> PII;
PII point[N];
double get_dis(PII a, PII b)
{
	return (double)sqrt((double)(a.first - b.first) * (a.first - b.first)
		+ (double)(a.second - b.second) * (a.second - b.second));
}
int cmp(Edge a, Edge b)
{
	if (a.w == b.w) {
		return a.a < b.a;
	}
	return a.w < b.w;
}
int find(int x)
{
	if (x != p[x]) {
		p[x] = find(p[x]);
	}
	return p[x];
}
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		int a, b;
		cin >> a >> b;
		point[i] = { a,b };
	}
	int cnt = 0;
	for (int i = 1; i <= n; i++) {
		p[i] = i;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			edge[cnt] = { i,j };
			double dis = get_dis(point[i], point[j]);
			edge[cnt++].w = dis;
		}
	}
	while (m--) {
		int a, b;
		cin >> a >> b;
		edge[cnt].a = a;
		edge[cnt].b = b;
		edge[cnt++].w = 0;
	}
	sort(edge, edge + cnt, cmp);
	double ans = 0;
	int top = 0;
	for (int i = 0; i < cnt; i++) {
		int a = find(edge[top].a);
		int b = find(edge[top].b);
		double w = edge[top++].w;
		if (a != b) {
			p[a] = b;
			ans += w;
		}
	}
	printf("%.2lf\n", ans);
	return 0;
}